<?php
namespace app\json\controller;

use think\Db;
class User 
{
    public function login(){
        $uphone = input('uphone');
        $pass = input('pass');
 
        $rs = Db::name('user')
            ->where('uphone',$uphone)
            ->where('upassword',md5($pass))
            ->where('ustatus', 1)
            // ->field('')
            ->find();
        // if($rs) {
        //     return json_encode(1);
        // }else{
        //     return json_encode(0);
        // }
        return json_encode($rs);
    }

    public function reg(){
        $data = input('get.');
        $rs = Db::name('user')->insert([
            'uphone' => $data['uphone'],
            'upassword' => md5($data['upassword']),
            'uname' => $data['uname'],
            'ustatus' => 1,

        ]);
        return json_encode($data);
    }

}